package com.guangwei.lockscreenforelder.lockscreen

import android.app.Service
import android.content.Context
import android.content.Intent
import android.os.IBinder
import android.util.Log

class LockScreenServiceGuider : Service() {
    override fun onBind(p0: Intent?): IBinder? {
        return null
    }

    override fun onCreate() {
        super.onCreate()
        Log.i("LockScreenServiceGuider", "LockScreenServiceGuider: onCreate********")
        LockScreenService.startLockScreenService(this)
    }

    override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
        return super.onStartCommand(intent, flags, startId)
        Log.i("LockScreenServiceGuider", "LockScreenServiceGuider: onStartCommand********")
        LockScreenService.startLockScreenService(this)
    }

    override fun onDestroy() {
        super.onDestroy()
        Log.i("LockScreenServiceGuider", "LockScreenServiceGuider: onDestroy********")
        LockScreenService.startLockScreenService(this)
    }

    companion object {
        fun startLockScreenServiceGuider(context: Context){
            val intent = Intent()
            intent.setClass(context, LockScreenServiceGuider::class.java)
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
            context.startService(intent)
            Log.i("LockScreenServiceGuider", "LockScreenServiceGuider: startLockScreenServiceGuider********")
        }
    }
}